<template>
  <div class="product-page" @click="productClick">
    <flexbox>
        <flexbox-item :span="2.2"><div class="flex-demo"><img  :src="loan.logoUrl"/></div></flexbox-item>
        <flexbox-item>
            <div class="flex-demo">
                <p><span>{{loan.partnerName}}</span><span v-if="loandesc === true" @click.self.stop="commission">{{loan.commissionDesc}}</span></p>
                <p>
                    <span>{{loan.description}}</span>
                </p>
                <p><span v-for="tag in JSON.parse(loan.productTag)">{{tag}}</span></p>
            </div>
        </flexbox-item>
    </flexbox>
</div>
</template>
<script>
import { Flexbox, FlexboxItem } from 'vux'
import utils from '../utils'
export default {
  props: ['loan', 'loandesc', 'partnershow', 'partnerType'],
  components: {
    Flexbox,
    FlexboxItem
  },
  methods: {
    productClick () {
      if (this.partnerType === '1') {
        this.$store.commit('changeIndexConf', {
            credit_type: ''
          })
          if (this.partnershow) {
            window.location.href = '/creditlogin/index?partnerId=' + this.loan.partnerId + '&userId=' + utils.getQueryString('userId') + '&channel=' + utils.getQueryString('channel')
          } else {
            window.location.href = '/loanGuest/detail?detail_id=' + this.loan.partnerId
          }
      } else if (this.partnerType === '3') {
        this.$store.commit('changeIndexConf', {
          credit_type: '3'
        })
        if (this.partnershow) {
          window.location.href = '/creditlogin/index?partnerId=' + this.loan.partnerId + '&userId=' + utils.getQueryString('userId') + '&channel=' + utils.getQueryString('channel')
        } else {
          this.$router.push('/creditGuest/detail?detail_id=' + this.loan.partnerId)
        }
      }
    },
    commission () {
      window.location.href = '/center/award?shareParam=share'
    }
  }
}
</script>
